package com.hospital.controller;

import com.hospital.entity.Register;
import com.hospital.service.intf.RegisterService;
import com.hospital.util.SessionUtil;
import com.hospital.vo.PageBean;
import com.hospital.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author fxy
 * @date 2022/8/30
 */
@RestController
@RequestMapping("/api/register/")
public class RegisterController {
    @Autowired
    private RegisterService registerService;

    //添加一条挂号信息

    @PostMapping("addregister.do")
    public R addregister(Register register){
        return registerService.addregister(register);
    }


    //查询所有有效的挂号信息
    @GetMapping("page.do")
    public PageBean page(String name, int page, int limit){
        return registerService.selectPage(name, page, limit);
    }

    @PostMapping("updateflage.do")
    public R updateflag(int uid){
        return registerService.updateflage(uid);
    }

    //查询所有有效的挂号信息
    @GetMapping("registerlog.do")
    public PageBean registerlog(String name, int page, int limit, HttpServletRequest request){

        return registerService.selectlogPage(name,page,limit, SessionUtil.getSeesion(request).getId());
    }



}
